package exam;

public class ObjectRef {
	public static void test1(String s) {
		s = "Java";
	}
	public static void test2(StringBuffer s) {
		s.append("Java");
	}
	public static void test3(StringBuffer s) {
		s = new StringBuffer("Java");
	}
	public static void main(String[] args) {
		String s = "Hello";
		test1(s);
		System.out.println("test1=" + s);
		StringBuffer sb = new StringBuffer("Hello");
		test2(sb);
		System.out.println("test2=" + sb.toString());
		test3(sb);
		System.out.println("test3=" + sb.toString());	
		A a=new A();
		a.display();
	}
}

class A {
    int a=11;
    double d=2.0;
    void display(){
        System.out.println("Class A: a="+a +"\td="+d);
    }
}
class B extends A{
    float a=3.0f;
    String d="Java program.";
    void display(){
        super.display();
        System.out.println("Class B: a="+a +"\td="+d);
    }
}
